<?php

namespace App\Http\Controllers;

use Illuminate\Http\JsonResponse;
use Illuminate\Routing\Controller as BaseController;

class TestController {

    public function testDelete () {
        dd(app('request')->all());
    }

    public function getDownload () {
        //PDF file is stored under project/public/download/info.pdf
        $file = public_path() . "/download/info.pdf";

        $headers = [
            'Content-Type: application/pdf',
        ];

        return response()->download($file, 'filename.pdf', $headers);
    }

    public function pdf () {
        //PDF file is stored under project/public/download/info.pdf
        $file = public_path() . "/download/info.pdf";
        $headers = [
            'Access-Control-Allow-Origin' => '*',
            'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, PUT, PATCH, DELETE',
            'Access-Control-Allow-Headers' => 'Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Authorization , Access-Control-Request-Headers',
            'Content-Type' => 'application/pdf',
            'Content-Disposition' => 'inline'
        ];

        return response()->file($file, $headers);
    }


    /**
     * 返回json数据
     * @return JsonResponse
     */
    public function getInputData () {
        $data = [
            'tr_code' => '4800120',
            'jrn_no' => '202007161539473370',
            'merc_id' => '',
            'merc_typ' => '1',
            'merc_cls' => '0',
            'merc_cnm' => '222',
            'merc_abbr' => '1',
            'merc_py_abbr' => '',
            'merc_hot_lin' => '',
            'fax' => ' ',
            'mcc_sub_cd' => ' 001',
            'mcc_cd' => '5094',
            'inn_id' => '009',
            'inn_id_sec' => '009111',
            'merc_prov' => '2900',
            'merc_city' => '2900',
            'merc_area' => '2904',
            'bus_addr' => '1',
            'open_acc_code' => ' ',
            'merc_attr' => ' 1',
            'reg_id' => ' 111',
            'bus_eff_dt' => ' 20200701',
            'bus_exp_dt' => ' 99991231',
            'bus_forever' => ' Y',
            'bus_scp' => ' 11',
            'reg_cap_amt' => ' 1',
            'reg_addr' => ' 11',
            'org_cod' => ' 1',
            'tax_cert_id' => ' ',
            'crp_nm' => ' 1',
            'crp_id_typ' => ' 00',
            'crp_id_no' => ' 510265790128303',
            'crp_eff_dt' => ' 20200701',
            'crp_exp_dt' => ' 99991231',
            'crp_forever' => ' Y',
            'chn_rel_flg' => ' ',
            'up_merc_id' => ' ',
            'up_merc_nm' => ' ',
            'clr_merc' => ' ',
            'web_url' => ' ',
            'mgt_sect' => ' ',
            'mgt_rgn' => ' ',
            'hol_bus_flg' => ' ',
            'mgt_scp' => ' ',
            'merc_trd_desc' => ' ',
            'staf_num' => ' ',
            'opn_bus_dt' => ' ',
            'ben_nm1' => ' 1',
            'ben_add1' => ' ',
            'ben_id_typ1' => ' ',
            'ben_id_no1' => ' ',
            'ben_eff_dt1' => ' ',
            'ben_exp_dt1' => ' ',
            'bcount' => ' 1',
            'shop_nm' => ' 1',
            'shop_desc' => ' 1',
            'shop_addr' => ' 1',
            'shop_conn' => ' 1',
            'shop_hours' => ' 1',
            'ctt_psn_typ' => ' ',
            'ctt_psn_cnm' => ' ',
            'mbl_tel' => ' ',
            'fix_tel' => ' ',
            'email' => ' ',
            'msn_qq' => ' ',
            'control_typ1' => ' 1',
            'control_nm1' => ' 2',
            'control_id_typ1' => ' 00',
            'control_id_no1' => ' 510265790128303',
            'control_eff_dt1' => ' 20200701',
            'control_exp_dt1' => ' 99991231',
            'control_forever1' => ' Y',
            'ccount' => ' 1',
            'hold_typ1' => ' 1',
            'hold_nm1' => ' 2',
            'hold_id_typ1' => ' 00',
            'hold_id_no1' => ' 510265790128303',
            'hold_eff_dt1' => ' 20200701',
            'hold_exp_dt1' => ' 99991231',
            'hold_forever1' => ' Y',
            'scount' => ' 1',
            'merc_src' => ' 1',
            'cus_mgr' => ' 1',
            'agr_no' => ' 1',
            'eff_dt' => ' 20200701',
            'exp_dt' => ' 20200716',
            'trust_nm' => ' 1',
            'trust_id_typ' => ' 00',
            'trust_id_no' => ' 510265790128303',
            'trust_eff_dt' => ' 18991205',
            'trust_exp_dt' => ' 99991231',
            'trust_forever' => ' Y',
            'rmk' => ' ',
            'inv_tit' => ' ',
            'inv_mail_addr' => ' ',
            'inv_mail_zip' => ' ',
            'resultName' => ' 0',
            'is_send' => ' 0',
            'usr_opr_nm' => ' 1',
            'usr_opr_mbl' => ' 15221835391',
            'thd_cd' => ' ',
            'usr_opr_email' => ' a@134.com',
            'merc_cert_typ' => ' RSA',
            'm_stl_sign' => ' 0',
            'm_bank_nm' => ' 1',
            'm_bnk_acnm' => ' 2',
            'm_stl_oac' => ' 3',
            'oper_prov_nm' => ' ',
            'oper_city_nm' => ' ',
            'oper_town_nm' => ' ',
            'need_inv_flg' => ' N',
        ];
        return response()->json($data);
    }

}
